package com.fenghongzhang.day010;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.Toast;

import com.ashokvarma.bottomnavigation.BottomNavigationBar;

public class MainActivity extends AppCompatActivity implements MyBottomNavigationBar.MyListener {
    private MyBottomNavigationBar myBar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        BottomNavigationBar bottomNavigationBar = new BottomNavigationBar(this);
//        bottomNavigationBar.addItem().addItem().addItem()

        myBar = (MyBottomNavigationBar) findViewById(R.id.my_bar);

        myBar.setMyListener(this);

        myBar.addItem(new MyBottomNavigationItem().setTitle("首页"))
                .addItem(new MyBottomNavigationItem().setTitle("电影"))
                .addItem(new MyBottomNavigationItem().setDrawable(getResources().getDrawable(R.drawable.ic_launcher_background)))
                .addItem(new MyBottomNavigationItem().setTitle("我的"))
                .build();

    }

    @Override
    public void selectItem(int i) {
        Toast.makeText(this, i+"", Toast.LENGTH_SHORT).show();
    }
}
